/*
 Navicat Premium Dump SQL

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44)
 Source Host           : 127.0.0.1:3306
 Source Schema         : smart_community

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44)
 File Encoding         : 65001

 Date: 13/09/2025 15:09:24
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sc_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sc_user_role`;
CREATE TABLE `sc_user_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  `granted_by` bigint(20) DEFAULT NULL COMMENT '授权人',
  `grant_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '授权时间',
  `expire_time` datetime DEFAULT NULL COMMENT '授权过期时间',
  `status` int(11) DEFAULT '1' COMMENT '状态：1-正常，2-禁用',
  `deleted` int(11) DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `create_by` bigint(20) DEFAULT NULL COMMENT 'åˆ›å»ºäºº',
  `update_by` bigint(20) DEFAULT NULL COMMENT 'æ›´æ–°äºº',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ›´æ–°æ—¶é—´',
  `version` int(11) DEFAULT '1' COMMENT 'ç‰ˆæœ¬å·',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user_role` (`user_id`,`role_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_role_id` (`role_id`),
  KEY `idx_grant_time` (`grant_time`),
  KEY `idx_user_role_grant` (`user_id`,`role_id`,`grant_time`)
) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户角色关联表';

-- ----------------------------
-- Records of sc_user_role
-- ----------------------------
BEGIN;
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (20, 5, 1, NULL, '2025-06-30 12:32:50', NULL, 1, 0, NULL, NULL, '2025-06-30 12:32:50', 1, '2025-06-30 12:32:50');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (21, 20, 1, NULL, '2025-07-05 15:55:57', NULL, 1, 0, 1, 1, '2025-07-05 15:55:57', 1, '2025-07-05 15:55:57');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (22, 21, 13, NULL, '2025-07-05 15:55:57', NULL, 1, 0, 1, 1, '2025-07-05 15:55:57', 1, '2025-07-05 15:55:57');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (23, 22, 1, NULL, '2025-07-05 15:57:39', NULL, 1, 0, 1, 1, '2025-07-05 15:57:39', 1, '2025-07-05 15:57:39');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (24, 23, 13, NULL, '2025-07-05 15:57:39', NULL, 1, 0, 1, 1, '2025-07-05 15:57:39', 1, '2025-07-05 15:57:39');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (29, 24, 1, NULL, '2025-07-09 07:15:10', NULL, 1, 0, NULL, NULL, '2025-07-09 15:15:10', 1, '2025-07-09 15:15:10');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (34, 9, 9, NULL, '2025-07-12 14:42:41', NULL, 1, 0, NULL, NULL, '2025-07-12 22:42:42', 1, '2025-07-12 22:42:42');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (35, 26, 9, NULL, '2025-07-17 14:53:57', NULL, 1, 0, NULL, NULL, '2025-07-17 22:53:57', 1, '2025-07-17 22:53:57');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (36, 28, 9, NULL, '2025-07-17 14:58:29', NULL, 1, 0, NULL, NULL, '2025-07-17 22:58:29', 1, '2025-07-17 22:58:29');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (37, 30, 3, NULL, '2025-07-17 15:04:48', NULL, 1, 0, NULL, NULL, '2025-07-17 23:04:48', 1, '2025-07-17 23:04:48');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (39, 1, 9, NULL, '2025-08-02 15:55:24', NULL, 1, 0, NULL, NULL, '2025-08-02 23:55:24', 1, '2025-08-02 23:55:24');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (42, 33, 9, NULL, '2025-08-07 08:38:40', NULL, 1, 0, NULL, NULL, '2025-08-07 16:38:40', 1, '2025-08-07 16:38:40');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (43, 31, 9, NULL, '2025-08-07 08:43:37', NULL, 1, 0, NULL, NULL, '2025-08-07 16:43:38', 1, '2025-08-07 16:43:38');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (47, 25, 9, NULL, '2025-08-07 09:56:53', NULL, 1, 0, NULL, NULL, '2025-08-07 17:56:54', 1, '2025-08-07 17:56:54');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (48, 34, 3, NULL, '2025-08-07 12:11:29', NULL, 1, 0, NULL, NULL, '2025-08-07 20:11:30', 1, '2025-08-07 20:11:30');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (49, 6, 9, NULL, '2025-08-08 04:55:21', NULL, 1, 0, NULL, NULL, '2025-08-08 12:55:22', 1, '2025-08-08 12:55:22');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (51, 36, 13, NULL, '2025-08-09 07:00:04', NULL, 1, 0, NULL, NULL, '2025-08-09 15:00:05', 1, '2025-08-09 15:00:05');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (52, 32, 9, NULL, '2025-08-12 05:29:15', NULL, 1, 0, NULL, NULL, '2025-08-12 13:29:16', 1, '2025-08-12 13:29:16');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (53, 35, 9, NULL, '2025-08-12 07:12:16', NULL, 1, 0, NULL, NULL, '2025-08-12 15:12:16', 1, '2025-08-12 15:12:16');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (55, 37, 13, NULL, '2025-08-15 08:18:38', NULL, 1, 0, NULL, NULL, '2025-08-15 16:18:38', 1, '2025-08-15 16:18:38');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (57, 38, 13, NULL, '2025-08-18 06:20:24', NULL, 1, 0, NULL, NULL, '2025-08-18 14:20:24', 1, '2025-08-18 14:20:24');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (59, 39, 13, NULL, '2025-08-22 02:37:52', NULL, 1, 0, NULL, NULL, '2025-08-22 10:37:53', 1, '2025-08-22 10:37:53');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (61, 40, 15, NULL, '2025-08-22 04:13:35', NULL, 1, 0, NULL, NULL, '2025-08-22 12:13:36', 1, '2025-08-22 12:13:36');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (63, 41, 15, NULL, '2025-08-22 05:19:57', NULL, 1, 0, NULL, NULL, '2025-08-22 13:19:58', 1, '2025-08-22 13:19:58');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (64, 42, 9, NULL, '2025-08-28 02:10:04', NULL, 1, 0, NULL, NULL, '2025-08-28 10:10:04', 1, '2025-08-28 10:10:04');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (65, 44, 6, NULL, '2025-08-28 05:13:33', NULL, 1, 0, 42, 42, '2025-08-28 13:13:33', 1, '2025-08-28 13:13:33');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (67, 45, 13, NULL, '2025-08-28 07:14:46', NULL, 1, 0, NULL, NULL, '2025-08-28 15:14:46', 1, '2025-08-28 15:14:46');
INSERT INTO `sc_user_role` (`id`, `user_id`, `role_id`, `granted_by`, `grant_time`, `expire_time`, `status`, `deleted`, `create_by`, `update_by`, `update_time`, `version`, `create_time`) VALUES (68, 46, 6, NULL, '2025-09-01 09:42:46', NULL, 1, 0, 42, 42, '2025-09-01 17:42:46', 1, '2025-09-01 17:42:46');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
